import { Tools } from 'weaver-mobile';

export const getButtonBaseInfo = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getButtonBaseInfo', method: 'POST', params});

//考勤签到
export const getButtons = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getButtons', method: 'POST', params});

export const getOutButtons = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getOutButtons', method: 'POST', params});

export const getLocationWifiInfo = (params = {}) => Tools.callApi({url: '/api/hrm/kq/grouplocation/getLocationWifiInfo', method: 'POST', params});

export const getWorkflowList = (params = {}) => Tools.callApi({url: '/api/hrm/kq/report/getHrmNewWorkflwList', method: 'GET', params});

export const punchButton = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/punchButton', method: 'POST', params});

export const init = (params = {}) => Promise.all([getButtons(), getLocationWifiInfo()])

//外勤
export const punchOutButton = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/punchOutButton', method: 'POST', params});

export const getOutSearchList = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getOutSearchList', method: 'POST', params});

export const searchNearBy = (params = {}) => Tools.callApi({url: 'https://restapi.amap.com/v3/place/around', method: 'GET', params, includeCredentials: false});

export const regeo = (params = {}) => Tools.callApi({url: 'https://restapi.amap.com/v3/geocode/regeo', method: 'GET', params, includeCredentials: false});

export const getOutButtonRange = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getOutButtonRange', method: 'POST', params});

export const getOutSignSetting = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getOutSignSetting', method: 'GET', params});

export const initOutside = (params = {}) => Promise.all([getButtonBaseInfo(), getOutButtonRange()]);

export const getAutoEMSet = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/getAutoEMSet', method: 'POST', params});

export const saveAutoEMSet = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/saveAutoEMSet', method: 'POST', params});

export const resetUserMap = (params = {}) => Tools.callApi({url: '/api/hrm/kq/attendanceButton/resetUserMap', method: 'POST', params});
